package com.neusoft.elmboot.mapper;

import com.neusoft.elmboot.po.Business;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface BusinessMapper {

	/**
	 * 根据点餐类别查询商家信息（根据商家编号升序排列）
	 * @param orderTypeId
	 * @return
	 */
	@Select("select * from business where orderTypeId=#{orderTypeId} and del = 0 order by businessId")
	public List<Business> listBusinessByOrderTypeId(Integer orderTypeId);

	/**
	 * 根据商家编号查询商家信息（根据商家编号升序排列）
	 * @param businessId
	 * @return
	 */
	@Select("select * from business where businessId=#{businessId} and del = 0 order by businessId")
	public List<Business> listBusinessByBusinessId(Integer businessId);

	@Select("select * from business where businessId = #{businessId} and del = 0")
	Business getBusinessById(Integer businessId);
	
	/**
	 * 查询商家列表（带分页功能）
	 * @param params
	 * @return
	 */
	List<Business> listAllBusiness(Map<String,Object> params);

	/**
	 * 查询商家总数
	 * @param params
	 * @return
	 */
	Long listAllBusinessCount(Map<String,Object> params);

	/**
	 * 新增商家
	 */
	Integer addBusiness(Business business);

	/**
	 * 更新商家（根据businessId全部更新）
	 * @param business
	 * @return
	 */
	Integer updateBusinessById(Business business);

	/**
	 * 删除商家（根据businessId逻辑删除）
	 * @param businessId
	 * @return
	 */
	Integer delBusiness(Integer businessId);
}